package com.hhkj.payment.wechat.notification.common.cont;

import com.hhkj.payment.wechat.notification.common.processor.RefundSuccessProcessor;
import com.hhkj.payment.wechat.notification.common.processor.TransactionSuccessProcessor;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * ProcessorEnum
 *
 * @author zheng
 * @since 2023/11/22 21:43
 */
@Getter
@AllArgsConstructor
public enum ProcessorEnum {
    REFUND_SUCCESS("REFUND.SUCCESS", RefundSuccessProcessor.class),
    TRANSACTION_SUCCESS("TRANSACTION.SUCCESS", TransactionSuccessProcessor.class),
    ;

    /** 事件类型编码 */
    private final String eventTypeCode;

    /** 类型信息 */
    private final Class<?> clazz;

    public static ProcessorEnum getByEventTypeCode(String eventTypeCode) {
        for (ProcessorEnum processorEnum : values()) {
            if (processorEnum.getEventTypeCode().equals(eventTypeCode)) {
                return processorEnum;
            }
        }
        return null;
    }

}
